package com.lnsf.bookstore.system.cart.controller;

import com.github.pagehelper.PageInfo;
import com.lnsf.bookstore.system.cart.service.CartService;
import com.lnsf.bookstore.system.cart.vo.Cart;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/cart")
public class CartController {

    @Autowired
    private CartService cartService;

    @RequestMapping("/list")
    @ResponseBody
    //@RequiresPermissions("cart:list")
    public Object list(@RequestParam Map<String, Object> params) {
        PageInfo<Cart> pageInfo = cartService.queryList(params);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",pageInfo);
        map.put("params",params);
        return map;
    }
}